#include "./conn.h"
#include "../pub_driver/cmd_can.h"

#ifdef APP_MAIN
#include "../main_driver/cmd_uart.h"
#endif

namespace conn {

#ifdef APP_MAIN
using namespace main_driver;
#endif

using namespace pub_driver;

void write(const uint8_t *buf, uint8_t len) {

#ifdef APP_MAIN
    uint8_t dst = buf[3];

    if (dst == addr::IPC) {
        cmdUart->write(buf, len);    
    } else {
        cmdCAN->write(buf, len);
    }
}

#else
    cmdCAN->write(buf, len);
#endif

}
